package com.tt.elasticsearch;

import com.tt.elasticsearch.pojo.Item;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate;
import org.springframework.data.elasticsearch.core.IndexOperations;
import org.springframework.data.elasticsearch.core.document.Document;

/**
 * @author 86176 shkstrat
 * @date 2020/11/19 - 11:27
 */
@SpringBootTest
public class ElasticsearchTemplate {

    @Autowired
    ElasticsearchRestTemplate elasticsearchRestTemplate;

    @Test
    void test02(){

        IndexOperations indexOps = this.elasticsearchRestTemplate.indexOps(Item.class);
        boolean b = indexOps.create();//创建索引库

        //Document mapping = indexOps.createMapping(Item.class);//索引请求
        //boolean b1 = indexOps.putMapping(mapping);

    }
}
